from selenium.webdriver.common.by import By
from selenium import webdriver

# 定位滚动条
driver = webdriver.Chrome()
driver.implicitly_wait(10)
# 滚动条控制 测试滚动条
js = "window.scrollTo(0,1000);"
driver.execute_script(js)

# 滚动到指定元素
def scrollTo_plus(self):
    element = self.driver.find_element(By.XPATH, '//*[@class="am-form form-validation nav-buy"]/div/button')  # 元素定位
    self.driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center'});", element)
